﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace drcoderz.com.clocks.chrono
{
    public class MiniClockHour : Control
    {
        public MiniClockHour()
        {
            this.DefaultStyleKey = typeof(MiniClockHour);
        }

        private RotateTransform miniClockHourHand;

        public override void OnApplyTemplate()
        {
            miniClockHourHand = this.GetTemplateChild("miniClockHourHand") as RotateTransform;
            base.OnApplyTemplate();
        }

        public Brush HandColor
        {
            get { return (Brush)GetValue(HandColorProperty); }
            set { 
                SetValue(HandColorProperty, value);
               
            }
        }

        // Using a DependencyProperty as the backing store for HandColor.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty HandColorProperty =
            DependencyProperty.Register("HandColor", typeof(Brush), typeof(MiniClockHour), new PropertyMetadata(new SolidColorBrush(Colors.Red)));



        public int Value
        {
            get { return (int)GetValue(ValueProperty); }
            set { SetValue(ValueProperty, value);
                    if (miniClockHourHand != null)
                        miniClockHourHand.Angle = value;
            }
        }

        // Using a DependencyProperty as the backing store for Value.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ValueProperty =
            DependencyProperty.Register("Value", typeof(int), typeof(MiniClockHour), new PropertyMetadata(null));

        
    }
}
